Skip to content

fix: warn and skip linking when a t-frame has no segments (#274)#276

Merged
JoOkuma merged 2 commits into
mainfrom
fix/issue-274-empty-nodes
Jun 1, 2026
Merged

fix: warn and skip linking when a t-frame has no segments (#274)#276
JoOkuma merged 2 commits into
mainfrom
fix/issue-274-empty-nodes

Conversation

@JoOkuma

@JoOkuma JoOkuma commented Jun 1, 2026

Copy link
Copy Markdown
Member

Closes #274. Supersedes #275 (branch deleted).

compute_spatial_neighbors crashed with IndexError: tuple index out of range when any t-frame had zero detected cells, because np.asarray([]).shape[1] is undefined.

Guard both source and target and emit a RuntimeWarning identifying which side and which t-frame is empty, then skip linking for that pair — so users running long timelapses can pinpoint the offending frame instead of hitting an opaque error inside multiprocessing.pool.

Adds a parametrized regression test covering empty source, empty target, and both-empty cases.

JoOkuma added 2 commits June 1, 2026 07:47
compute_spatial_neighbors crashed with IndexError: tuple index out of
range when either source or target nodes were empty, because
np.asarray([]) returns a 1D array of shape (0,) and target_pos.shape[1]
is then undefined.

Guard both sides and emit a RuntimeWarning identifying which side
(source or target) and which t-frame is empty, so users running long
timelapses can pinpoint the offending frame instead of hitting an opaque
error inside multiprocessing.pool.

Adds a parametrized regression test covering empty source, empty target,
and both-empty cases.

Closes #274
@JoOkuma JoOkuma merged commit f21dc66 into main Jun 1, 2026
4 checks passed
@JoOkuma JoOkuma deleted the fix/issue-274-empty-nodes branch June 1, 2026 15:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

IndexError in compute_spatial_neighbors when a timepoint has zero detected cells

1 participant